package singleton;

//懒汉式单例设计模式
//线程不安全，在多线程的场景下，可能会返回不同的对象
public class Singleton2 {
    private static Singleton2 instance;

    private Singleton2() {

    }

    public static Singleton2 getInstance() {
        if(instance == null) {
            instance = new Singleton2();
        }

        return instance;
    }
}
